﻿using Bookvar.ObjectModel;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Bookvar.UnitTests.ObjectModel
{
    /// <summary>
    /// Unit tests for the <see cref="Topic"/> class.
    /// </summary>
    [TestClass]
    public class TopicTests
    {
        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext { get; set; }

        [TestMethod]
        public void CanCreateNew()
        {
            var topic = new Topic();
            Assert.IsNotNull( topic );
        }

        [TestMethod]
        public void WhenNewTopicIsAddedToSubtopics_ParentPropertyOfTheNewTopicIsOk()
        {
            var topic = new Topic();
            var newTopic = new Topic();

            topic.SubTopics.Add( newTopic );

            Assert.AreSame( topic, newTopic.Parent );
        }

        // TODO: Fix the test.
//        [TestMethod]
//        public void WhenParentIsSetToAParentTopic_TheTopicIsInTheParentSubtopics()
//        {
//            var topic = new Topic();
//            var parent = new Topic();
//
//            topic.Parent = parent;
//
//            CollectionAssert.Contains( parent.SubTopics, topic );
//        }
    }
}